
<!-- BEGIN:main --> 

<script language="javascript" type="text/javascript">
    function submitHanghoa(action)
    {

    if(action=='cancel'){
        window.history.back(2);
    }else{
        
         var H_ID = $('#H_ID');
         var HH_HANG_HOA = $('#HH_HANG_HOA');
         var DVT_ID = $('#DVT_ID');
         var HH_DON_GIA_NHAP = $('#HH_DON_GIA_NHAP');
         var HH_DON_GIA_BAN = $('#HH_DON_GIA_BAN');
         var HH_DON_GIA_SI = $('#HH_DON_GIA_SI');
         var HH_DON_GIA_LE = $('#HH_DON_GIA_LE');
         
         var arrayInput = new Array(HH_HANG_HOA,HH_DON_GIA_NHAP);
        var hasError = validateEmptyValue(arrayInput);
        if (hasError) {
            alert('Vui lòng điền đầy đủ dữ liệu');
        } else {
        var dataString = 'hdAction=' + action;
        dataString += '&H_ID=' + H_ID.val();
        dataString += '&HH_HANG_HOA=' + HH_HANG_HOA.val();
        dataString += '&DVT_ID=' + DVT_ID.val();
        dataString += '&HH_DON_GIA_NHAP=' + HH_DON_GIA_NHAP.val();
        dataString += '&HH_DON_GIA_BAN=' + HH_DON_GIA_BAN.val();
        dataString += '&HH_DON_GIA_SI=' + HH_DON_GIA_SI.val();
        dataString += '&HH_DON_GIA_LE=' + HH_DON_GIA_LE.val();
        
        $.ajax({
            url: '.?com=com_hanghoa&task=edit',
            type: "POST",
            data: dataString,
            cache: false,
            success: function(data) {
                if (data.trim() == 'OK') {
                    alert('Cập nhật thành công');
//                    window.location.reload();
                    window.location.href='.?com=com_hanghoa';
                }
            }
        });
        
            }
    }
       


    }
</script> 


<!--biến giá trị hành động-->

<!-- BEGIN:hanghoa -->
<div data-role="content">
   
        <h2><div class="header icon-48-article-edit">
                        Hàng hóa: <small><small>[ Sửa ]</small></small>
                    </div></h2>

        <form method="post" name="phpForm" id="phpForm" action="" class="ui-body ui-body-c ui-corner-all">
            
            
            <input type="hidden" name="H_ID" id="H_ID" value="{H_ID}"/>
            <input type="hidden" name="hdAction" id="hdAction" />
            <div data-role="fieldcontain" >
                <label for="name-c" style=" width:150px;display: inline-block; ">Tên hàng hóa:</label>
                <input type="text" name="HH_HANG_HOA" id="HH_HANG_HOA" value="{H_TEN}"  />
            </div>

            <div data-role="fieldcontain">
                <label for="select-choice-c" class="select" style=" width:150px;display: inline-block; ">Đơn vị tính:</label>
                <select name="DVT_ID" id="DVT_ID" data-theme="c" data-overlay-theme="d" data-native-menu="false">
                   
                    {DVT}
                    
                </select>
            </div>
            <div data-role="fieldcontain">
                <label for="number" style=" width:150px;display: inline-block; ">Đơn giá nhập (VNĐ):</label>
                <input type="number" name="HH_DON_GIA_NHAP" id="HH_DON_GIA_NHAP" value="{H_GIA_NHAP}" />
            </div>
           
           <input type="hidden" name="HH_DON_GIA_BAN" id="HH_DON_GIA_BAN" value="{H_GIA_BAN}" />
            <input type="hidden" name="HH_DON_GIA_SI" id="HH_DON_GIA_SI" value="{H_GIA_BAN_SI}" />
             <input type="hidden" name="HH_DON_GIA_LE" id="HH_DON_GIA_LE" value="{H_GIA_BAN_LE}" />
            

      
            <div class="ui-body ui-body-b">
                <fieldset class="ui-grid-a">
                    <div class="ui-block-a">
                        <a href="javascript:void()" onclick="submitHanghoa('cancel');" data-role="button"  data-theme="c">
                            Cancel</a>
                    </div>
                    <div class="ui-block-b">
                        <a href="javascript:void()" onclick="submitHanghoa('edit');" data-role="button"  data-theme="b">
                            Lưu</a>
                    </div>
                    
                </fieldset>
            </div>
        </form>

  




</div>
  <!-- END:hanghoa -->
<div data-role="footer" data-theme="b" data-position="fixed">
    <div class="ui-bar">
        <a href="./?com=com_hanghoa" data-role="button" data-icon="refresh" data-theme="b" style="float:left;">Trở lại</a>
        <!--<a href="javascript:void()" onclick="submitForm11('remove');" data-role="button" data-icon="delete" data-theme="b" style="float:right;" class="returnTopAction">Xóa</a>-->             
    </div>
</div>   



<!-- END:main -->
